﻿$("#menu > ul > li > ul").mouseenter(function () {
    $(this).prev("a").addClass("t-state-hover");
});
$("#menu > ul > li > ul").mouseleave(function () {
    $(this).prev("a").removeClass("t-state-hover");
});
$(document).ajaxSend(function (event, jqXHR, ajaxOptions) {
    if (ajaxOptions.showBusyCursor != null && !ajaxOptions.showBusyCursor) return;
});
$(document).ajaxComplete(function () {
    $('body').removeClass('loading');
});
function DisplayTrintechAjaxError(jqXHR, textStatus, errorThrown) {
    OpenExceptionDialog(jqXHR.statusText);  //Function in _MessageDialog.cshtml
}

function ReplaceHtmlAndShowElement(elementId, someNewHtml) {
    $('#' + elementId).show();
    $('#' + elementId).html(someNewHtml);
}

function ResetHtmlAndHideElement(elementId) {
    $('#' + elementId).hide();
    $('#' + elementId).html('');
}

function DisplayMessage(elementId, someNewHtml) {
    ReplaceHtmlAndShowElement(elementId, someNewHtml);
}

function DisplayMessageWithIcon(elementId, messageType, messageText) {
    //Parm descriptions:
    //elementID:    The element whose HTML you want to replace with the message.
    //messageType:  Determines what kind of icon to show, and how to display the text.
    //              Valid values are these strings:  error, information, success, warning
    //messageText:  The message text

    var iconClass = '';  //default
    var labelClass = ''; //default

    if (iconType == 'error') {
        iconClass = 'class="messageIconError"';
        labelClass = 'class="redFont"';  //error messages are shown in red font
    }
    else if (iconType == 'information') {
        iconClass = 'class="messageIconInformation"'; 
    }
    else if (iconType == 'success') {
        iconClass = 'class="messageIconSuccess"'; 
    }
    else if (iconType == 'warning') {
        iconClass = 'class="messageIconWarning"'; 
    }

    var theString = '<table width="100%"><col width="20" /><tr><td align="right"><p ' + iconClass + ' /></td><td align="left"><label ' + labelClass + '>' + messageText + '</label></td></tr></table>';

    $('#' + elementId).show();
    $('#' + elementId).empty();
    $('#' + elementId).append(theString);
}
 



